package observers;

import java.util.List; 
import java.util.ArrayList; 
import java.io.IOException; 
import java.io.FileNotFoundException; 

public class Observable {
	
	private List<Observer> obs = new ArrayList<Observer>(); 
	
	public void registerObserver(Observer o){
		obs.add(o); 
	}
	
	public Observer getObservers(int j){
		return obs.get(j); 
	}
	
	public void unregisterObserver(Observer o) {
		obs.remove(o); 
	}
	
	public void notifyObservers(Event e)throws FileNotFoundException, IOException{ 
		for(int i = 0; i<obs.size(); i++) {
			obs.get(i).processEvent(e); 
		}
	}
}
